package com.actimize.model;

	import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

	import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;

	/**
	 */
	@Entity
	@Table(name = "payee")
	@Indexed
	@XmlRootElement
	public class Payee extends BaseObject implements Serializable {
	    private static final long serialVersionUID = 32359421L;

	    private Long payeeId;
	    private String payeeName;                    // required
	    private String payeeAccount;                    // required
	    private String payeeSort;

	    /**
	     * Default constructor - creates a new instance with no values set.
	     */
	    public Payee() {
	    }

	    public Payee(final String payeeName) {
	        this.payeeName = payeeName;
	    }

	    @Id
	    @GeneratedValue(strategy = GenerationType.AUTO)
	    @DocumentId
	    public Long getPayeeId() {
	        return payeeId;
	    }

	    
	    @Column(name = "payeeName", nullable = false, length = 50)
	    @Field
	    public String getPayeeName() {
	        return payeeName;
	    }

	    @Column(name = "payeeAccount", nullable = false, length = 50)
	    @Field
	    public String getPayeeAccount() {
	        return payeeAccount;
	    }

	    @Column(name = "payeeSort", nullable = false, length = 50)
	    @Field
	    public String getPayeeSort() {
	        return payeeSort;
	    }


	    public void setPayeeId(Long payeeId) {
	        this.payeeId = payeeId;
	    }

	    public void setPayeeName(String payeeName) {
	        this.payeeName = payeeName;
	    }

	    public void setPayeeAccount(String payeeAccount) {
	        this.payeeAccount = payeeAccount;
	    }

	    public void setPayeeSort(String payeeSort) {
	        this.payeeSort = payeeSort;
	    }

	    /**
	     * {@inheritDoc}
	     */
	    public boolean equals(Object o) {
	        if (this == o) {
	            return true;
	        }
	        if (!(o instanceof Payee)) {
	            return false;
	        }

	        final Payee payee = (Payee) o;

	        return !(payeeId != null ? !payeeId.equals(payee.getPayeeId()) : payee.getPayeeId() != null);

	    }

	    /**
	     * {@inheritDoc}
	     */
	    public int hashCode() {
	        return (payeeId + payeeName != null ? (payeeId + payeeName).hashCode() : 0);
	    }

	    /**
	     * {@inheritDoc}
	     */
	    public String toString() {
	        ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE)
	                .append("payeeId", this.payeeId)
	                .append("payeeName", this.payeeName)
	                .append("payeeAccount", this.payeeAccount)
	                .append("payeeSort", this.payeeSort);

	        return sb.toString();
	    }
	}
